package cn.gzjp.modules.gas.entity;

import cn.gzjp.common.config.ConfigUtils;
import cn.gzjp.common.utils.StringUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.validator.constraints.Length;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;

import java.math.BigDecimal;

/**
 * 加油站油枪Entity
 *
 * @author zengcp
 * @version 2018-03-05
 */
public class GasGun extends DataEntity<GasGun> {

    private static final long serialVersionUID = 1L;
    private String stationId;        // 加油站
    private String stationName;  //加油站名称
    private String gunSn;        // 油枪编号
    private String categoryId;        // 油类id
    private String categoryName;        // 油类名称
    private BigDecimal price;        // 当前销售价格
    private BigDecimal monthL;        // 月销售量L
    private BigDecimal monthM;        // 月销售金额
    private BigDecimal discount; // 当前优惠(元)

    private String qrcodePath;//二维码地址

    public GasGun() {
        super();
    }

    public GasGun(String id) {
        super(id);
    }

    public String getStationId() {
        return stationId;
    }

    public void setStationId(String stationId) {
        this.stationId = stationId;
    }

    @JsonIgnore
    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    public String getGunSn() {
        return gunSn;
    }

    public void setGunSn(String gunSn) {
        this.gunSn = gunSn;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @JsonIgnore
    public BigDecimal getMonthL() {
        return monthL;
    }

    public void setMonthL(BigDecimal monthL) {
        this.monthL = monthL;
    }

    @JsonIgnore
    public BigDecimal getMonthM() {
        return monthM;
    }

    public void setMonthM(BigDecimal monthM) {
        this.monthM = monthM;
    }

    @JsonIgnore
    public String getQrcodePath() {
        return qrcodePath;
    }

    public void setQrcodePath(String qrcodePath) {
        this.qrcodePath = qrcodePath;
    }

    public String getQrcodeUrl() {
        if (StringUtils.isNotBlank(qrcodePath)) {
            String photoUrl = ConfigUtils.getProperty("photoUrl");
            return photoUrl + qrcodePath;

        }
        return "";
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }
}